﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TesteOnline.Model;
using MySql.Data.MySqlClient;

namespace TesteOnline
{
    public partial class NewSimpleQuestionForm : System.Web.UI.Page
    {
        //Bll.Wrapper wrapper = new Bll.Wrapper();
        //Disciplines[] vet;
        quizdb.QuizDb db = new quizdb.QuizDb(new MySqlConnection("Persist Security Info=False;server=localhost;database=quizdb;uid=root;server=localhost;database=quizdb;uid=root;pwd='';initial catalog=quizdb"));

        protected void Page_Load(object sender, EventArgs e)
        {
            DropDownList1.DataSource = db.MaterIA;
//            DropDownList1.DataMember = "Nome";
            DropDownList1.DataTextField = "Nome";
            DropDownList1.DataValueField = "IdMateria";
            //vet = wrapper.GetDisciplines().ToArray();
            //ListBox1.DataSource = vet;
            //ListBox1.DataTextField = "Name";
            //ListBox1.DataValueField = "Id";
            //ListBox1.DataMember = "Name";
            DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //Response.Write(Request.Params["ListBox1"] + "</br>");
            //Response.Write(TextBox1.Text + "</br>");
            //Response.Write(Certa.Checked + "</br>");
            //int idMateria = Int32.Parse( Request.Params["ListBox1"]);
            //wrapper.AddNewQuestion(idMateria, new Question( TextBox1.Text, Certa.Checked));
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Response.Write(DropDownList1.SelectedValue);
            //DropDownList2.DataSource = db.MaterIA;
            //DropDownList2.DataMember = "Nome";
            //DropDownList2.DataTextField = "Nome";
        }
    }
}